package com.SunSoft.PhoneRemoteControl;

import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.Handler;
import android.os.Message;
import android.widget.Toast;
import java.lang.reflect.Field;
import java.util.ArrayList;

final class ch
  implements DialogInterface.OnClickListener
{
  public final void onClick(DialogInterface paramDialogInterface, int paramInt)
  {
    Object localObject;
    try
    {
      localObject = paramDialogInterface.getClass().getSuperclass().getDeclaredField("mShowing");
      ((Field)localObject).setAccessible(true);
      ((Field)localObject).set(paramDialogInterface, Boolean.valueOf(false));
      this.a.bY = 0;
      paramInt = 0;
      if (paramInt < this.a.bR)
        break label144;
      MainControl.a("Test", "sum_key_count:" + String.valueOf(this.a.bY));
      if (this.a.bY != 0)
        break label310;
      Toast.makeText(this.a, this.a.getString(2131099951), 0).show();
      label144: label310: label1088: label1110: return;
    }
    catch (SecurityException paramDialogInterface)
    {
      paramDialogInterface.printStackTrace();
    }
    catch (NoSuchFieldException paramDialogInterface)
    {
      paramDialogInterface.printStackTrace();
    }
    catch (IllegalArgumentException paramDialogInterface)
    {
      paramDialogInterface.printStackTrace();
    }
    catch (IllegalAccessException paramDialogInterface)
    {
      int j;
      while (true)
      {
        while (true)
          paramDialogInterface.printStackTrace();
        this.a.bT = this.a.bV[paramInt].getSelectedItemPosition();
        this.a.bS = Integer.valueOf((String)this.a.bK.get(this.a.bT)).intValue();
        this.a.bN[this.a.bI][paramInt] = this.a.bS;
        if (this.a.bS > 0)
        {
          paramDialogInterface = this.a;
          paramDialogInterface.bY += 1;
        }
        MainControl.a("Test", String.valueOf(paramInt) + ":" + String.valueOf(this.a.bT) + "," + String.valueOf(this.a.bS));
        paramInt += 1;
      }
      this.a.bW = 1;
      if (this.a.bY > 9)
        this.a.bW = 2;
      if (this.a.bY > 18)
        this.a.bW = 3;
      this.a.bZ = new String[this.a.bW];
      float f = this.a.bY / this.a.bW + 0.5F;
      MainControl.a("Test", "per_count_f:" + String.valueOf(f));
      int i1 = (int)f;
      int i2 = this.a.bY - ((this.a.bW - 1) * i1);
      MainControl.a("Test", "sum_key_count:" + String.valueOf(this.a.bY));
      MainControl.a("Test", "sum_download_count:" + String.valueOf(this.a.bW));
      MainControl.a("Test", "per_download_count:" + String.valueOf(i1));
      MainControl.a("Test", "last_download_count:" + String.valueOf(i2));
      paramInt = 1;
      paramDialogInterface = "";
      int i = 0;
      int l = 0;
      if (l >= this.a.bR)
      {
        paramDialogInterface = new Message();
        paramDialogInterface.what = 26;
        this.a.ca.sendMessage(paramDialogInterface);
        return;
      }
      this.a.bS = this.a.bN[this.a.bI][l];
      localObject = paramDialogInterface;
      int k = i;
      if (this.a.bS > 0)
      {
        localObject = this.a.bO[this.a.bS];
        if ((localObject == null) || (((String)localObject).length() < 20))
        {
          paramDialogInterface = paramDialogInterface + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000";
          MainControl.a("Test", "len errror:0");
          i += 1;
          if ((paramInt != this.a.bW) || (i != i2))
          {
            localObject = paramDialogInterface;
            k = i;
            if (paramInt >= this.a.bW)
              break label1110;
            localObject = paramDialogInterface;
            k = i;
            if (i != i1)
              break label1110;
          }
          i = i * 41 + 5;
          localObject = MainControl.a(i);
          if (((String)localObject).length() < 4)
            break label1088;
          paramDialogInterface = "FB" + MainControl.a(this.a.bW * 16 + paramInt) + ((String)localObject) + "300000" + paramDialogInterface;
          MainControl.a("Test", "download_len:" + String.valueOf(i));
          MainControl.a("Test", "download_code:" + paramDialogInterface);
          this.a.bZ[(paramInt - 1)] = paramDialogInterface;
          paramInt += 1;
          j = 0;
        }
      }
      for (paramDialogInterface = ""; ; paramDialogInterface = (DialogInterface)localObject)
      {
        while (true)
        {
          while (true)
            l += 1;
          if (((String)localObject).startsWith("FA"))
          {
            localObject = ((String)localObject).substring(2, 4) + MainControl.a(l) + ((String)localObject).substring(6);
            MainControl.a("Test", "format_code:" + ((String)localObject));
          }
          while (true)
          {
            while (((String)localObject).length() >= 82)
            {
              while (true)
                paramDialogInterface = paramDialogInterface + ((String)localObject);
              localObject = "04" + MainControl.a(l) + MainControl.a(((String)localObject).length() / 2) + ((String)localObject);
            }
            localObject = localObject + "0";
          }
          localObject = "0" + ((String)localObject);
        }
        j = k;
      }
    }
  }
}